package lp2.projeto.agenda;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

/**
 * Dialogo de sobre
 */
public class SobreJDialog extends JDialog {
	/**
	 * Construtor do dialogo sobre
	 */
	public SobreJDialog() {
		setTitle("Sobre");
		setModal(true);
		setSize(300, 130);
		setResizable(false);
		
		JPanel panel = (JPanel)getContentPane();
		
		panel.setLayout(new GridBagLayout());
		
		GridBagConstraints constraints = new GridBagConstraints();
		
		constraints.gridx = 0;
		constraints.gridy = 0;
		constraints.weightx = 0.0;
		constraints.weighty = 0.0;
		constraints.anchor = GridBagConstraints.CENTER;
		constraints.fill = GridBagConstraints.NONE;
		constraints.gridwidth = 2;
		
		JLabel label = new JLabel("Tibia frost label");
		
		panel.add(label, constraints);
		
		constraints.gridx = 0;
		constraints.gridy = 1;
		constraints.weightx = 1.0;
		constraints.weighty = 1.0;
		constraints.fill = GridBagConstraints.BOTH;
		constraints.gridwidth = 2;
		
		JTextArea textArea = new JTextArea();
		textArea.setText("Desenvolvedores:\n" +
				"\tFelipe Abella\n" +
				"\tLucas Ribeiro\n" +
				"\tTercio de Melo");
		textArea.setEditable(false);
		
		panel.add(textArea, constraints);
		
		constraints.gridy = 2;
		constraints.gridx = 1;
		constraints.gridwidth = 1;
		constraints.weightx = 0.0;
		constraints.weighty = 0.0;
		constraints.fill = GridBagConstraints.NONE;
		
		JButton okButton = new JButton("Ok");
		okButton.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				dispose();
			}
		});
		
		panel.add(okButton, constraints);
	}
	
	public static void main(String[] args) {
		SobreJDialog sobre = new SobreJDialog();
		sobre.setVisible(true);
	}
}
